<template>
  <el-dialog :visible.sync="visible" :title="title" @close="handleClose">
    <slot></slot>
    <span slot="footer" class="dialog-footer">
      <el-button @click="handleClose">Cancel</el-button>
      <el-button type="primary" @click="confirm">Confirm</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
      title: 'Modal Title'
    }
  },
  methods: {
    handleClose() {
      this.visible = false;
    },
    confirm() {
      this.$emit('confirm');
      this.handleClose();
    }
  }
}
</script>

<style scoped>
</style>
